chore(router): trim dependencies by inlining small single-use helpers - #8975
chore(router): trim dependencies by inlining small single-use helpers#8975gioboa wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 29e94c3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
a907dfd to
406fb4c
Compare
@qwik.dev/core
@qwik.dev/router
@qwik.dev/utils
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
@qwik.dev/devtools
commit: |
d12e906 to
ec9aada
Compare
ec9aada to
b5fca24
Compare
maiieul
left a comment
There was a problem hiding this comment.
Hmmm this looks good. Thanks @gioboa! Will make maintaining deps easier for sure 👍 Can you add a small comment on each vendor helper that says which vendor it was copied from? This way it reduces the likelihood for a future PR, especially with AI, to introduce a bug into those.
|
Good idea @maiieul 👍 |
b5fca24 to
630ca10
Compare
maiieul
left a comment
There was a problem hiding this comment.
magic-string impl says "minimal replacement". Copied source code is good but half baked AI impl is risky. Let's remove it please.
|
Fair enough 👍 Reverted the custom |
630ca10 to
766741d
Compare
8603537 to
6eb2657
Compare
6eb2657 to
29e94c3
Compare
What
Several dependencies of
@qwik.dev/routerare used for a single function call. This PR replaces them with verbatim vendored copies of the upstream sources and removes dead dev-dependencies. It also dropsmagic-stringentirely from the workspace (including as a runtime dependency of@qwik.dev/core).Result: router goes from 26 → 17 direct dependencies, and core sheds
magic-string. Every app installs fewer packages and ~3MB lessnode_modules. No behavior changes, no client-bundle impact.How
Policy: pure copy/paste or nothing — no minimal reimplementations to maintain. Each vendored file carries a header with the source package, version, license, and upstream URL; the only edits are TypeScript type annotations. That keeps behavior byte-for-byte identical to what the dependency did (GitHub anchor ids, cookie parsing edge cases, NO_COLOR/TTY detection, ESTree serialization of bigint/RegExp/Map/Set/cycles).
marked(932KB)menu.mdremark-parse, already installed via@mdx-js/mdx@azure/functions(472KB)github-sluggerslugger.ts+slugger-regex.ts)estree-util-value-to-estreevalue-to-estree.ts)set-cookie-parserparseStringcallparseStringpath (parse-set-cookie.ts)hast-util-to-string,hast-util-heading-rankhast-util-to-string.ts,hast-util-heading-rank.ts)kleurkleur/colors(kleur-colors.ts)magic-stringString.replaceinqwik-vite(manifest injection) and the docs REPL build; the transform now returns anullsourcemap for the manifest module, and function replacers fix latent$-pattern expansion@types/mdx,mdast-util-mdxDev-dependency cleanup: dropped
uvu(asserts migrated to vitest),tsm(unused),@types/refractor(empty stub),@types/set-cookie-parser.Verification
tsc.checkclean, eslint clean on all touched filesoptimizer.mjscontains zero magic-string references; lockfile refreshed (13 packages removed)Kept on purpose
source-map,unified,vfile,unist-util-visitare directly imported but already installed via@mdx-js/mdx— removing them saves nothing and creates phantom deps.mlly,yaml,csstype,launch-editor, and the remaining deps are real features, public-API types, or not worth the correctness risk.Bigger wins (
zod+valibot~4.2MB,refractor+svgo~4.5MB as optional peers) are possible but breaking — left for a separate discussion.